home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 46
/
046.d81
/
aces up
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
8KB
|
246 lines
100 rem ***aces up***
110 gosub 1760:mm$=" "
120 poke 53280,0:poke53281,0
130 poke56334,1:poke53272,21:poke53265,155
140 printchr$(8);chr$(142);
150 goto350
160 poke53280,14:poke53281,14:printchr$(142)"[147][146][213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]";
170 fora=1to22:print"[221]"spc(38)"[221]";:next
180 print"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203][157][157][192]"
190 fora=217to242:pokea,peek(a)or128:next
200 print" loadstar presents:"
210 print" "
220 print" aces up "
230 print" "
240 print" by jason olds "
250 print" "
260 print" copyright 1987 "
270 print" "
280 print" "
290 print" press space to continue"
300 ifpeek(203)<>60then300
310 goto440
320 rem
330 rem
340 rem
350 print"[147]loading data..."
360 ifml=0thenml=1:load"acesup.chars",8,1
370 dim card$(4,13):gosub 1820
380 open4,8,4,"0:acesup.cards,s,r"
390 fora=1to4:forb=1to13:input#4,ca$(a,b):next:next:close4
400 dim c(52)
410 dimp(4)
420 dims(4,13)
430 n=52:fori=1ton:c(i)=i:nexti:goto160
440 bl$=" [157][157][157][157][157][157][157] [157][157][157][157][157][157][157] [157][157][157][157][157][157][157] [157][157][157][157][157][157][157] "
450 bl$=bl$+"[157][157][157][157][157][157][157] [144]@ [157][157][157][157][157][157][157] "
460 print"[145]do you need intructions (y/n) ?"
470 geta$:ifa$<>"y"anda$<>"n"then470
510 rem ***set up cards, and chuffle***
520 print"[147]":poke 53265,peek(53265)or64:poke53282,1
530 poke 56334,peek(56334)or1:poke53272,(peek(53272)and240)+12
540 ifa$="y"thenpoke53280,0:poke53281,0:gosub1970
550 n=52:fori=1ton-1:r=(n+1-i)*rnd(0):r=int(r)+i:t=c(r):c(r)=c(i):c(i)=t:next
560 p(1)=0:p(2)=0:p(3)=0:p(4)=0
570 co=1
580 print"[147]";
590 sp=1
600 p$="[144]@"
610 ifa$="y"thenpoke53280,0:poke53281,0:gosub1970
620 print"[147]":poke 53280,0:poke53281,6
630 rem ***set board***
640 print" aces up ";
650 print"[146] j=pointer left k=pointer right"
660 print" return=deal cards space=remove card"
670 print" p=push card q=quit game";
680 rem ***print first card***
690 poke 2,203:cp=1
700 ifco=53then880
705 n=1:gosub1090
710 n=2:gosub1090
720 n=3:gosub1090
730 n=4:gosub1090
740 gosub 1030
750 gosub 1740
760 rem***main***
770 rem
780 geta$:ifa$=""then780
790 if a$="j"thensp=sp-1:ifsp=0thensp=4
800 if a$="k"thensp=sp+1:ifsp=5thensp=1
810 if a$=chr$(13)thengosub1740:goto700
820 ifa$=" "thengoto1140
830 ifa$="p"then1420
840 ifa$="q"then1950
850 gosub1030
860 goto780
870 rem ***check for a winner***
880 ifp(1)=1andp(2)=1andp(3)=1andp(4)=1then900
890 goto 1610
900 if s(1,1)=13ors(1,1)=26ors(1,1)=39ors(1,1)=52then920
910 goto 1610
920 if s(2,1)=13ors(2,1)=26ors(2,1)=39ors(2,1)=52then940
930 goto 1610
940 if s(3,1)=13ors(3,1)=26ors(3,1)=39ors(3,1)=52then960
950 goto 1610
960 if s(4,1)=13ors(4,1)=26ors(4,1)=39ors(4,1)=52then980
970 goto 1610
980 goto1680
990 end
1000 rem ***number to card converter***
1010 x=int(num/13.1)+1:y=int(13*(1-x))+num
1020 return
1030 print"";spc(8);:fora=1top(1)+5:print"";:next:print" "
1040 print"";spc(15);:fora=1top(2)+5:print"";:next:print" "
1050 print"";spc(22);:fora=1top(3)+5:print"";:next:print" "
1060 print"";spc(29);:fora=1top(4)+5:print"";:next:print" "
1070 print"";spc(sp*7+1);:fora=1top(sp)+5:print"";:next:printp$
1080 return
1090 rem put card in pile 1 2 3 or 4
1100 num=c(co):gosub1000:p(n)=p(n)+1:
1110 s(n,p(n))=num:print"";spc(n*7-1);:ifp(n)<>1thenfora=1top(n)-1:print"";:next
1120 printca$(x,y)
1130 co=co+1:return
1140 rem***remove card***
1150 ifp(sp)=0then1380
1160 num=s(sp,p(sp)):gosub1000
1170 b1=x:b2=y:h1=y
1180 fora=1to4
1190 ifp(a)=0thengoto1220
1200 num=s(a,p(a))
1210 gosub1000:ifb1=xandy>b2thenh1=y
1220 next
1230 if h1=b2 then 1380
1240 d=0:fora=1to4:num=s(a,p(a)):gosub1000:ifb1=xthend=d+1
1250 next
1260 ifd=1then1380
1270 p(sp)=p(sp)-1
1280 print"";
1290 ifp(sp)=0then1310
1300 fora=1top(sp):print"";:next
1310 printspc(sp*7-1);bl$
1320 print"";
1330 ifp(sp)=0then1370
1340 ifp(sp)=1then1360
1350 fora=1top(sp)-1:print"";:next
1360 num=s(sp,p(sp)):printspc(sp*7-1);:gosub1000:printca$(x,y)
1370 goto760
1380 print".............can't do that..............[146]"
1390 gosub1790:fora=1to500:next
1400 print" aces up [146]";
1410 goto760
1420 rem ***push***
1430 ifsp=0then1380
1440 ss=0
1450 fora=4to1step-1:ifp(a)=0thenss=a
1460 next
1470 ifss=0then1380
1480 p(ss)=p(ss)+1:s(ss,1)=s(sp,p(sp)):p(sp)=p(sp)-1
1490 print"";
1500 ifp(sp)=0then1520
1510 fora=1top(sp):print"";:next
1520 printspc(sp*7-1);bl$
1530 print"";
1540 num=s(ss,p(ss)):printspc(ss*7-1);:gosub1000:printca$(x,y)
1550 print"";
1560 ifp(sp)=0then1600
1570 ifp(sp)=1then1590
1580 fora=1top(sp)-1:print"";:next
1590 num=s(sp,p(sp)):printspc(sp*7-1);:gosub1000:printca$(x,y)
1600 goto760
1610 print"";
1612 printmm$:printmm$:printmm$"[145][145][145]"
1620 print" sorry, no more deals..."
1630 print" do you wish to play again (y/n) ?"
1640 geta$:ifa$<>"y"anda$<>"n"then1640
1645 poke56334,1:poke2,21:poke53265,27:print"[147]"
1650 ifa$="y"thenpoke 2,0:goto 160
1660 ifa$<>"n"then1640
1662 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
1664 ifer<>63thenend
1670 sys 49234:load "hello connect",8:end
1680 rem ***winner***
1690 print"[147]";:fora=1to24:print:next
1695 poke56334,1:poke2,21:poke53265,27:poke53280,.:poke53281,.:poke53272,21
1700 print" congratulations ... you won!!":fora=1to10:print:next
1710 for a=1to100:poke 53280,a and 15:poke 53281,a and 15:for b=1 to 25:next
1720 next:print""
1730 poke 53280,0:poke 53281,0:goto1630
1740 print"deal #";(co-1)/4;" out of 13";
1745 ifint((co-1)/4)<>13thenprint:goto1780
1747 print"[159] your last deal"
1750 return
1760 rem setup sid
1770 sd=54272:for a=sd to sd+24:poke a,0:next
1780 return
1790 rem beep
1800 pokesd+24,15:poke sd+5,31:pokesd+6,208:pokesd,240:pokesd+1,4:pokesd+4,33
1810 fors=1to200:next:pokesd+4,0:pokesd,0:pokesd+1,0:pokesd+24,0:return
1820 rem machine language
1830 for a=49152 to 49296:read b:poke a,b:next
1840 sys 49194:poke 2,0
1850 return
1860 data169,1,141,25,208,162,59,160,216,173,18,208,197,2,176,9,169,29,141,24
1870 data208,165,2,208,11,162,27,160,200,169,21,141,24,208,169,0,141,18,208,76
1880 data 128
1890 data192,173,20,3,141,160,3,173,21,3,141,161,3,120,169,0,141,20,3,169
1900 data192,141,21,3,169,1,141,26,208,169,27,141,17,208,169,127,141,13,220,88
1910 data96,120,173,160,3,141,20,3,173,161,3,141,21,3,169,240,141,26,208,169,27
1920 data141,17,208,169,0,141,13,220,169,120,141,25,208,169,21,141,24,208,32,132
1930 data255,88,96,248,104,104,173,13,220,41,1,240,3,76,49,234,76,188,254,0,0,0
1940 data 0
1950 poke 56334,1:poke 2,21:poke53265,27:poke 53280,0:poke 53281,0
1960 print"[147]";:goto 1630
1970 poke2,106:gosub 2450:print" aces up ";
1980 print"[146][159]aces are high, ranking above kings."
1990 print"[156]a row of four cards are dealt as above. ";
2000 print"any card that is lower than another card";
2010 print"of the same suit may be discarded. ";
2020 print"example: the above cards show the ace"
2030 print"and king of hearts. the king is lower"
2040 print"than the ace, and may be discarded."
2050 print"[153]you move the cursor, using the 'j' and"
2060 print"'k' keys. follow the computer's moves."
2070 for a=1 to 9000:next:x=1
2080 for a=1 to 800:next:x=x+1:print"";spc((x-1)*8-1);" ";spc(7);"@"
2090 ifx<3 then 208